# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=pycryptodome
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.14.1
pkgrel=1
pkgdesc="Collection of cryptographic algorithms and protocols, implemented for use from Python (mingw-w64)"
url="https://www.pycryptodome.org/"
license=('BSD')
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
depends=("${MINGW_PACKAGE_PREFIX}-gmp"
         "${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools"
             "${MINGW_PACKAGE_PREFIX}-cc")
source=("${_realname}-${pkgver}.tar.gz::https://github.com/Legrandin/pycryptodome/archive/v${pkgver}.tar.gz")
sha256sums=('2da3d5c2ecd3c3b73946ef00dc585d590e869deacdfe464cefba96f50d13682f')

prepare() {
  cd ${srcdir}
  cp -r ${_realname}-${pkgver} build-python-${CARCH}
}

build() {
  cd ${srcdir}/build-python-${CARCH}
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd ${srcdir}/build-python-${CARCH}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --skip-build

  install -Dm644 LICENSE.rst "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE.rst"
}
